/*
 * ${beanName}ServiceImpl.java created on ${config.createTime?string("yyyy-MM-dd")} by ${config.createUser}
 */
package ${config.pack}.service.impl;

import java.util.List;

import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.ssm.core.common.BusinessMap;
import org.ssm.core.common.Pager;
import org.ssm.core.utils.IDUtils;
import ${config.pack}.entity.${beanName};
import ${config.pack}.entity.${beanShowVo};
import ${config.pack}.entity.${beanQueryVo};
import ${config.pack}.mappers.${beanName}Mapper;
import ${config.pack}.service.${beanName}Service;

/**
 * ${config.beanDescription} Service 实现
 * TODO javadoc for ${config.pack}.service.impl.${beanName}ServiceImpl
 * @Copyright: ${config.copyright}
 * @author: ${config.createUser}
 * @since: ${config.createTime?string("yyyy-MM-dd HH:mm:ss")}
 */
@Service
public class ${beanName}ServiceImpl implements ${beanName}Service {

	@Autowired
	private ${beanName}Mapper ${simpleBeanName}Mapper;
	
	@Override
	public void search(Pager<${beanShowVo}> pager, ${beanQueryVo} ${simpleBeanName})  {
		List<${beanShowVo}> dataList = ${simpleBeanName}Mapper.pageList(${simpleBeanName},new RowBounds((pager.getCurrentPage() - 1) * pager.getLimit(), pager.getLimit()));
		pager.setDataList(dataList);
		Long total =${simpleBeanName}Mapper.pageTotal(${simpleBeanName});
		pager.setTotal(total);
	}
	
	@Override
	@Transactional
	public BusinessMap create(${beanName} ${simpleBeanName}) {
		BusinessMap bm=new BusinessMap();
		${simpleBeanName}.set${columnList[0].javaPropertyName?cap_first}(IDUtils.genUUID());
		${simpleBeanName}Mapper.add(${simpleBeanName});
		return bm;
	}
	
	@Override
	public ${beanName} getById(String ${beanId})  {
		return ${simpleBeanName}Mapper.getById(${beanId});
	}
	
	@Override
	@Transactional
	public BusinessMap edit(${beanName} ${simpleBeanName})  {
		BusinessMap bm=new BusinessMap();
		${simpleBeanName}Mapper.edit(${simpleBeanName});
		return bm;
	}

	@Override
	@Transactional
	public BusinessMap delete(String ${beanId})  {
		 BusinessMap bm=new BusinessMap();
		 ${simpleBeanName}Mapper.deleteById(${beanId});
		 return bm;
	}

}
